home *** CD-ROM | disk | FTP | other *** search
- Path: news.crystalball.com!news
- From: Larry Weiss <lfw@oc.com>
- Newsgroups: comp.lang.c
- Subject: Re: why arrays may seem like pointers
- Date: Wed, 28 Feb 1996 12:41:11 -0600
- Organization: crystalball.com
- Message-ID: <3134A1C7.3FB7@oc.com>
- References: <4gsdno$1bg@umbc9.umbc.edu> <4gtab6$acb@ceylon.gte.com> <313318b8.53776146@nntp.ix.netcom.com> <DnHyrp.CF8@eskimo.com>
- NNTP-Posting-Host: external.oc.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (Win16; I)
-
- Steve Summit wrote:
- >
- > Having learned this, I'm now careful to say things like, "When
- > you make reference to an array in an expression, the compiler
- > automatically generates a pointer to its first element, just as
- > if you'd written &array[0]." I try to use words like "generate,"
- > and *not* to use words like "convert."
- >
-
- Also, it is common jargon to say the array reference "decays" into
- a pointer. The word "decay" confused me when I first learned the
- language, as it conveys that something actually happened to the array.
-
- If you are quite naive, and still pondering strange "algebraic"
- expressions like
- x = x + 1
- then it's even more important to get clear explanations of array
- semantics. It's actually "too bad" that one must understand pointers
- in order to understand arrays, in general, but then, that's C.
-